home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-24 | 3.1 KB | 98 lines | [TEXT/MMCC] |
- // ===========================================================================
- // LHierarchicalListBox.h ©1994 Jan Bruyndonckx All rights reserved.
- // v1.0 18/6/94
- //
- // A hierarchical listbox subclass. The listbox contains only string data.
- // ===========================================================================
-
- #pragma once
-
- #include "CCustomListBox.h"
-
- //----------------------------------------------------------------------------
-
- typedef enum {
- kHasSubList = 0x01, // item contains sub-items (eg. folder)
- kIsOpened = 0x02, // the item is opened
- kDrawFilled = 0x04, // draw the triangle filled
- kDrawIntermediate = 0x08 // draw intermediate state
- } TwistDownFlags ;
-
- #pragma options align=mac68k
-
- #define TWIST_DOWN_HEAD \
- Byte indent ; /* indentation level */ \
- Byte flags ; /* display flags */
-
- typedef struct {
- TWIST_DOWN_HEAD
- } TwistDownHeader ;
-
- typedef struct {
- TWIST_DOWN_HEAD
- Byte data[2] ; // variable length of data (default=P-String)
- } TwistDownRec, *TwistDownRecPtr ;
-
- #pragma options align=reset
-
- #define TwistDownRecSize (sizeof(TwistDownHeader)) // don't count the variable 'data' field
-
- //----------------------------------------------------------------------------
-
- class CTwistDownListBox : public CCustomListBox {
-
- public:
- enum {
- classID = 'hlst'
- } ;
-
- static CTwistDownListBox* CreateFromStream(LStream *inStream);
-
- CTwistDownListBox () ;
- CTwistDownListBox (const SPaneInfo &inPaneInfo,
- Boolean inHasHorizScroll, Boolean inHasVertScroll,
- Boolean inHasGrow, Boolean inHasFocusBox,
- MessageT inDoubleClickMessage, Int16 inTextTraitsID,
- LCommander *inSuper);
- CTwistDownListBox (const CTwistDownListBox &inOriginal);
- CTwistDownListBox (LStream *inStream);
-
- virtual StringPtr GetDescriptor(Str255 outDescriptor) const;
- virtual void SetDescriptor(ConstStr255Param inDescriptor);
- virtual void FullyExpand (const unsigned short inMaxDepth = 0xFFFF) ;
-
- void MouseInfo (Point theMouse, Boolean *inButtonArea, Cell *theCell) ;
-
- protected:
- short triangleWidth ; // width of the triangle area
-
- virtual void ClickSelf(const SMouseDownEvent &inMouseDown); // override LListBox
- virtual void ResizeFrameBy (Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh); // override LListBox
-
- virtual void DrawElementSelf (const Rect *lRect,
- const void *lElement,
- const short lDataLen) ;
- virtual void DrawTwistedElement (const Rect *lRect,
- const TwistDownRecPtr twistElement,
- const short lDataLen) ;
-
- virtual void CollapseElement (const Cell theCell) ;
- virtual void ExpandElement (const Cell theCell) ;
-
- virtual void ListLimitReached (void) ;
-
- typedef enum { // Misc. constants
- kTriangleOutsideGap = 1, // From margin to button
- kTriangleInsideGap = 3, // From button to text
- kScrollBarWidth = 16, // width of right scroll bar
- kAnimationDelay = 3, // the time to show the intermediate button
- kIndentOffset = 16 // to offset each indentation level by
- } ;
-
- private:
- void init (void) ;
-
- static PolyHandle sClosedPoly,
- sOpenedPoly,
- sIntermediatePoly ;
- } ;